package chapter5;

/**
 * Java方法传递基本类型参数, Java方法参数传递都是值传递，即传递的副本
 * 原变量并不受影响
 */
public class PrimitiveTransferTest {
    public static void swap(int a, int b) {
        int temp = a;
        a = b;
        b = temp;
        System.out.println("swap方法里a的值是:" + a + " b的值是:" + b);
    }

    public static void main(String[] args) {
        int a = 6;
        int b = 9;
        swap(a, b);
        System.out.println("交换结束后，a的值是:" + a + " b的值是:" + b);
    }
}
